<?php

    class testSections extends CodeIgniterUnitTestCase {

        public function __construct() {
            parent::__construct('testSections');

            $this->activeLang = 'me';
            $this->level = 0;
        }

        public function setUp() {
            
        }

        public function tearDown() {
            
        }

        function printTree($tree, &$ul) {
            if (!is_null($tree) && count($tree) > 0) {
                $ul.= '<ul>';
                foreach ($tree as $node) {
                    $ul.= '<li>' . $node['post_title'];
                    $this->printTree($node['children'], $ul);
                    $ul.= '</li>';
                }
                $ul.= '</ul>';
            }
        }

        public function testSection() {

            $query = "SELECT * FROM posts where parent_ID = ?";

            $recordset = array();

            $columns = array(
                'post_title' => 'post_title',
                'content' => 'content',
                'parent_ID' => 'parent_ID',
            );

            recrusive($this->db, $this->translate, $this->activeLang, $query, 45, $recordset, $columns);

            $tree = parseTree($recordset, 45, $columns);
            $ul = "";
            $this->printTree($tree, $ul);

            $this->dump($ul);
        }

    }
    